﻿Public Class CalibracionCV
    Private Sub TextBoxCambio_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ButtonCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCalcular.Click
        Dim resultado As Double = 0
        If TextBoxKgha.Text <> "" Then
            Dim kgha As Double = TextBoxKgha.Text
            Dim porcentaje As Integer = 100
            For i = 0 To porcentaje Step 1
                resultado = (kgha * i) / porcentaje
                'Debug.WriteLine("KgHa: " & resultado & " cambio: " & i)
                ListBoxCalibracion.Items.Add("Cambio: " & 100 - i & " Kg por Ha: " & Math.Round(resultado, 1))
                MainForm.vectorCambio(100 - i) = Math.Round(resultado, 1)
            Next
            MessageBox.Show("La calibracion ha sido guardada")
            My.MySettings.Default.ValorDeCalibracion = kgha
            My.MySettings.Default.Save()
        Else
            MessageBox.Show("Campo vacio")
        End If
    End Sub

    Private Sub ButtonSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSalir.Click
        Me.Close()
    End Sub
End Class